<?php

/*
    display a panel for user to select a file and begin upload.
    Form action (at upload completion) is filemaster, where
    unzipping etc. takes place.
*/
    
function echo_php_upload($project, $prompt = 'Submit',
            $max_size='100000000')
{
            global $site_url;
            $prompt = _($prompt);
            $projectid = $project->ProjectId();

            echo "
    <form name='form_upload' 
              enctype='multipart/form-data' 
              method='POST'
              action='{$site_url}/filemaster.php"
                        ."?projectid={$projectid}'>

    <script type='text/javascript'>
        function eSelectFile()
        {
            var fctl = document.form_upload.projectzipfile;
            var path = fctl.value;
            if(! path) return;
            var updiv = document.getElementById('divuploading');
            updiv.style.display = 'block';
            document.form_upload.submit();
        }
    </script>
        <input type='hidden' name='MAX_FILE_SIZE' 
                                      value='{$max_size}' />
        <div>
            <label>Upload a zip file:</label> 
            <input type='file' size='50' name='projectzipfile' 
                                            onchange='eSelectFile()'>
        </div>
        <div style='display: none; color: green;' id='divuploading'>
        <h3>Uploading....</h3>
        </div>
    </form>\n";

}

?>
